<?php
@session_start();
    include_once '../../Model/M_Rubro.php';
    
    $rubro = new M_Rubro();
    $listaRubros = $rubro->searchRubro_All();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
        <title>Registrar Sub Rubro</title>  
        <link rel="stylesheet" href="../css/jquery-ui.css" />
        <link rel="stylesheet" href="../css/mantenedores.css" />
        <script src="../js/jquery-1.8.2.js"></script>
        <script src="../js/jquery-ui.js"></script>
        <script src="../js/autocompletado.js"></script>  
        <style type="text/css">
            @import "../css/mantenedores.css";
            @import "../css/principal.css";
        </style>
        <style>
            .ui-combobox {
                position: relative;
                display: inline-block;
            }
            .ui-combobox-toggle {
                position: absolute;
                top: 0;
                bottom: 0;
                margin-left: -1px;
                padding: 0;
                /* adjust styles for IE 6/7 */
                /*height: 1.7em;
                top: 0.1em;*/
            }
            .ui-combobox-input {
                height: 15px;
                margin: 0;
                padding: 0.3em;
                width: 130px;
            }
            .ui-autocomplete {
                max-height: 150px;
                overflow-y: auto;
                /* prevent horizontal scrollbar */
                overflow-x: hidden;
            }
        </style>  
        <script>
            function check()
            {
                if (document.formulario.nom.value == '')
                {
                    alert("Debe ingresar un nombre. Gracias");
                    document.forms[0].nom.focus();
                    return false;                  
                }
                if (document.formulario.idRubro.value == '')
                {
                    alert("Debe seleccionar un rubro. Gracias");
                    document.forms[0].idRubro.focus();
                    return false;                  
                }
            }
        </script>
    </head>
    <body>
        <div id='lineatitulo'>            
            <label align="center" style="font-weight: bold;">Adicionar Subrubro</label>
        </div>
        <br/> 
        <form name="formulario" method="post" action="../../Controller/C_SubRubro_I.php" onsubmit="return check();" enctype="multipart/form-data">
            <input type="hidden" name="idPag" value="<? echo($_REQUEST['idPag']);?>">
            <div id="formularios">
                <table border="0" align="center">
                        <tr>
                            <td>Nombre: <font color="#FF0000">(*)</font></td>                            
                            <td><input placeholder="INGRESE NOMBRE" style="width: 300px;" type="text" name="nom" /></td>
                        </tr>
                        <tr>
                            <td>Rubro: <font color="#FF0000">(*)</font></td>                            
                            <td>
                                <div class="ui-widget">
                                    <select id="combobox" name="idRubro">
                                        <option value="">Seleccione...</option>
                                        <?php
                                        for($i=0;$i<(count($listaRubros));$i++)
                                        {
                                        ?>
                                            <option value="<?php echo($listaRubros[$i]['id_rubro']); ?>"><?php echo($listaRubros[$i]['nombre']); ?></option>
                                        <?php
                                        }
                                        ?>
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr>                            
                            <td>Imagen: <font color="#FF0000">(*)</font></td>                            
                            <td><input type="file" name="rutaImagen"></td>
                        </tr>
                        <tr align="center">                            
                            <td colspan="2">
                                <input class="button_rojo" onclick="javascript:history.go(-1)" height='30px' type="button" value="Cancelar"/>
                                <input class="botones" type="submit" value="Registrar"/>
                            </td>
                            
                        </tr>                        
                </table>
                </div>
        </form>

    </body>
</html>
<?php
    
?>